/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/*
 * listaPagosPendientesBanco.java
 *
 * Created on Jan 7, 2012, 9:29:26 AM
 */

package INTERFAZ;

import CONTROLES.ControlCuenta;
import CONTROLES.ControlEmpleado;
import CONTROLES.ControlSucursal;
import CONTROLES.ControlSueldo;
import CONTROLES.ControlTipoCambio;
import CONTROLES.ControlUsuario;
import MODELOS.Cliente;
import MODELOS.Cuenta;
import MODELOS.Empleado;
import MODELOS.Sucursal;
import MODELOS.Sueldo;
import MODELOS.TipoCambio;
import MODELOS.Usuario;
import Reportes.Reporte;
import UTILITARIOS.Fecha;
import UTILITARIOS.Herramienta;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import UTILITARIOS.MiModelo;
import UTILITARIOS.StringToDate;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.text.DateFormatter;

/**
 *
 * @author VICENTE
 */
public class listaSueldosPagados extends javax.swing.JDialog {
    /** Creates new form listaPagosPendientesBanco */
    public listaSueldosPagados(javax.swing.JFrame parent, boolean modal){
        super(parent, modal);
        initComponents();
        iniciarComponentes();
        addEventos();
    }

    private void iniciarComponentes(){
        tipoCambio = new ControlTipoCambio().dameCambio();
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, -7);
        java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("dd-MM-yyyy");
        String fecha = sdf.format(c.getTime());
        panelPickFechas2.setDate(fecha);
        fechaI = new Fecha();
        fechaI.setFecha(new StringToDate().convertir(panelPickFechas2.getDateText()));

        fechaF = new Fecha();
        fechaF.setFecha(new StringToDate().convertir(panelPickFechas1.getDateText()));
        sucursal = Bienvenida.sucursal;

        jLabel7.setVisible(false);
        jLabel8.setVisible(false);
        jLabel6.setText(String.valueOf(tipoCambio.getTipoCompra()));
        jLabel11.setText(sucursal.getNombreSuc());
        jLabel3.setText("DEL: "+fechaI.getFechaPrincipal()+" AL "+fechaF.getFechaPrincipal());        

        String sucursales[] = new ControlSucursal().nombresSuc();        
        for(int i = 0; i<sucursales.length; i++)
           choice1.add(sucursales[i]);

        choice1.select(sucursal.getIdSucursal()+"-"+sucursal.getNombreSuc());

        if(Bienvenida.user.getTipoUsuario().equalsIgnoreCase("ADMINISTRADOR") && Bienvenida.user.getToken().equalsIgnoreCase("INGRESAR") ){
           choice1.setEnabled(true);
           }else{
           choice1.setEnabled(false);
           }

        listSueldos = new ControlSueldo().getListaSueldosPagados(sucursal.getIdSucursal(), fechaI.getFechaDate(), fechaF.getFechaDate());
        cargarTabla(listSueldos);

    }
    
    private void addEventos(){

        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                

                fechaI.setFecha(new StringToDate().convertir(panelPickFechas2.getDateText()));
                fechaF.setFecha(new StringToDate().convertir(panelPickFechas1.getDateText()));

                StringTokenizer s = new StringTokenizer(choice1.getSelectedItem(),"-");
                int idSucursal = Integer.parseInt(s.nextToken());

                jLabel3.setText("DEL: "+fechaI.getFechaPrincipal()+" AL "+fechaF.getFechaPrincipal());
                jLabel11.setText(sucursal.getNombreSuc());
                
                listSueldos = new ControlSueldo().getListaSueldosPagados(idSucursal, fechaI.getFechaDate(), fechaF.getFechaDate());
                cargarTabla(listSueldos);
            }
        });
        imprimir.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                StringToDate conv = new StringToDate();
                String fechaI = panelPickFechas2.getDateText();
                Date fechaIni = conv.convertir(fechaI);

                String fechaF = panelPickFechas1.getDateText();
                Date fechaFin = conv.convertir(fechaF);
                new Reporte().ejecutarListaSueldo(fechaIni, fechaFin);
            }
        });
        salir.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        pagos = new javax.swing.JTable();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        salir = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        choice1 = new java.awt.Choice();
        jLabel2 = new javax.swing.JLabel();
        panelPickFechas1 = new UTILITARIOS.PanelPickFechas();
        panelPickFechas2 = new UTILITARIOS.PanelPickFechas();
        jButton1 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        imprimir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Lista de Sueldos");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "LISTA DE SUELDOS ", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 0, 14))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel2.setName("jPanel2"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        pagos.setName("pagos"); // NOI18N
        jScrollPane1.setViewportView(pagos);

        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("TOTAL DE TABLE");
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("TOTAL Real $us:");
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel9.setText("total");
        jLabel9.setName("jLabel9"); // NOI18N

        jLabel12.setText("TOTAL Bs.");
        jLabel12.setName("jLabel12"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1020, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel12))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("LISTA DE SUELDOS PAGADOS ");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("DEL :     AL:");
        jLabel3.setName("jLabel3"); // NOI18N

        salir.setFont(new java.awt.Font("Tahoma", 0, 12));
        salir.setText("SALIR");
        salir.setName("salir"); // NOI18N

        jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("jLabel11");
        jLabel11.setName("jLabel11"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1041, Short.MAX_VALUE)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1041, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 1031, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 1031, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(953, Short.MAX_VALUE)
                .addComponent(salir)
                .addGap(23, 23, 23))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11)
                .addGap(16, 16, 16)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(salir))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Criterios de busqueda"));
        jPanel3.setName("jPanel3"); // NOI18N

        choice1.setName("choice1"); // NOI18N

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel2.setText("Elegir Sucursal");
        jLabel2.setName("jLabel2"); // NOI18N

        panelPickFechas1.setName("panelPickFechas1"); // NOI18N

        panelPickFechas2.setName("panelPickFechas2"); // NOI18N

        jButton1.setText("Listar");
        jButton1.setName("jButton1"); // NOI18N

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel4.setText("Inicio");
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel10.setText("Fin");
        jLabel10.setName("jLabel10"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(44, 44, 44)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addGap(376, 376, 376)
                        .addComponent(jButton1))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addComponent(panelPickFechas2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(panelPickFechas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(choice1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(106, 106, 106))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(choice1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(panelPickFechas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(11, 11, 11)
                        .addComponent(jButton1))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(panelPickFechas2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel5.setText("T.C. COMPRA:");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel6.setText("jLabel6");
        jLabel6.setName("jLabel6"); // NOI18N

        imprimir.setFont(new java.awt.Font("Tahoma", 0, 12));
        imprimir.setText("IMPRIMIR LISTA");
        imprimir.setName("imprimir"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(187, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 597, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(118, 118, 118)
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(imprimir)
                        .addGap(31, 31, 31))))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 1042, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(jLabel5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(imprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    /**
    * @param args the command line arguments
    */

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Choice choice1;
    private javax.swing.JButton imprimir;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable pagos;
    private UTILITARIOS.PanelPickFechas panelPickFechas1;
    private UTILITARIOS.PanelPickFechas panelPickFechas2;
    private javax.swing.JButton salir;
    // End of variables declaration//GEN-END:variables
    private MiModelo modelo_pagos;

    ArrayList<Sueldo> listSueldos;
    private TipoCambio tipoCambio;
    private Fecha fechaI;
    private Fecha fechaF;
    private Sucursal sucursal;

    private void cargarTabla(ArrayList<Sueldo> lista) {
        double total = 0;       
        modelo_pagos = new MiModelo(new Object [][] {},new String [] {"ID SUELDO", "Nombre","Apellido","Fecha de Pago", "Usuario", "Sueldo"}, -1);
        Sueldo cu;
        Empleado emp;
        Usuario usu;
        StringToDate ds = new StringToDate();
        if(lista.size()>0){
            for(int i=0;i<lista.size();i++){
                cu = lista.get(i);
                emp = new ControlEmpleado().dameEmpleado(cu.getIdEmpleado());
                usu = new ControlUsuario().getUsuarioPermiso(cu.getIdUsuario());

                Object [] auxPago = {
                    cu.getIdSueldo(),
                    emp.getNombreEmpleado(),
                    emp.getApellidoEmp(),
                    ds.dateAstring(cu.getFechaPago()),
                    usu.getNombreUsuario(),
                    Herramienta.redondearDoubleString(cu.getMontoSueldo())
                };
                    total = Herramienta.redondear(total+cu.getMontoSueldo(),2);
                    modelo_pagos.addRow(auxPago);
            }
        }
        jLabel9.setText(Herramienta.redondearDoubleString(total));
        pagos.setModel(modelo_pagos);
        DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();
        tcr.setHorizontalAlignment(SwingConstants.RIGHT);

        DefaultTableCellRenderer tcrc = new DefaultTableCellRenderer();
        tcrc.setHorizontalAlignment(SwingConstants.CENTER);

        pagos.getColumnModel().getColumn(0).setMaxWidth(120);
        pagos.getColumnModel().getColumn(0).setMinWidth(100);
        pagos.getColumnModel().getColumn(0).setCellRenderer(tcr);
        pagos.getColumnModel().getColumn(1).setCellRenderer(tcrc);
        pagos.getColumnModel().getColumn(2).setCellRenderer(tcrc);
        pagos.getColumnModel().getColumn(3).setCellRenderer(tcrc);        
        pagos.getColumnModel().getColumn(4).setCellRenderer(tcrc);
        pagos.getColumnModel().getColumn(5).setMaxWidth(90);
        pagos.getColumnModel().getColumn(5).setCellRenderer(tcr);
        pagos.getColumnModel().getColumn(5).setMaxWidth(90);
                
                      
    }
}